{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "number is 9\n",
      "number is 8\n",
      "number is 7\n",
      "number is 6\n",
      "number is 4\n",
      "number is 3\n",
      "number is 2\n",
      "number is 1\n",
      "number is 0\n"
     ]
    }
   ],
   "source": [
    "number = 10\n",
    "while number >= 1:\n",
    "    number -= 1\n",
    "    if number == 5:\n",
    "        # break\n",
    "        continue\n",
    "\n",
    "    print(f\"number is {number}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "name\n",
      "language\n",
      "Sessions\n",
      "Other name\n"
     ]
    }
   ],
   "source": [
    "movie1 = { \"name\":\"Friends\", \"language\":\"En\", \"Sessions\":10, \"Other name\":\"Six of One\" }\n",
    "for title in movie1.keys():\n",
    "    print(title)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 4, 9, 16]\n"
     ]
    }
   ],
   "source": [
    "# 推导式\n",
    "list1 = [ i*i for i in (1, 2, 3, 4) ]\n",
    "print(list1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[9, 16]\n"
     ]
    }
   ],
   "source": [
    "list2 = [ i*i for i in (1, 2, 3, 4) if i > 2]\n",
    "print(list2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1, 2, 1, 2, 0, 2, 2, 2, 1, 0, 1, 1, 2, 2, 0]\n"
     ]
    }
   ],
   "source": [
    "data = [[ 1, 2, 1, 2, 0 ],\n",
    "        [ 2, 2, 2, 1, 0 ],\n",
    "        [ 1, 1, 2, 2, 0 ]]\n",
    "list2 = []\n",
    "for i in data:\n",
    "    for j in i:\n",
    "        list2.append(j)\n",
    "\n",
    "print(list2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "number = 100\n",
    "\n",
    "if number < 100:\n",
    "    if number % 7 == 0:\n",
    "        pass    # pass 暂时不写逻辑，并防止报错\n",
    "    else:\n",
    "        pass\n",
    "else:\n",
    "    pass"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.10.7 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
